package com.maimao.auth;

import com.maimao.core.interceptor.FeignInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.http.client.OkHttp3ClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;

/**
 * @author MaoLin Wang
 * @date 2020/11/29 10:18 下午
 */
@RefreshScope
@EnableDiscoveryClient
@EnableFeignClients
@MapperScan("com.maimao.auth.mapper")
@ComponentScan(basePackages = {"com.maimao"})
//@ComponentScan(basePackages = {"com.maimao.api"})
//@ComponentScan(basePackages = {"com.maimao.core"})
@SpringBootApplication
public class AuthApplication {
    public static void main(String[] args) {
        SpringApplication.run(AuthApplication.class, args);
    }
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate(new OkHttp3ClientHttpRequestFactory());
    }

    @Bean
    public FeignInterceptor feignInterceptor(){
        return new FeignInterceptor();
    }

}
